Repository navigation
Start HttpCacheManager without its local server (startServer: false) - #20
Merged
Merged
Conversation
HttpCacheStream.cacheUrl fell back to the source URL when the manager had no server, so a player handed it would silently bypass the cache. It now throws CacheServerUnavailableException, as getCacheUrl does, and HttpCacheStream.hasCacheUrl / HttpCacheManager.hasServer let callers check first. Document that ensureActive() is a no-op and port is ignored without a server.
Without a server and with a cacheDir or config given, init's closure has no await, so its finally block cleared _initFuture before the ??= stored it. The completed future stayed behind, and the next init after dispose handed back the disposed manager.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
HttpCacheManager.init(startServer: false), which starts the manager without its local cache server, for consumers that read streams directly throughcreateStreamandHttpCacheStream.requestinstead of over HTTP. No socket is bound, so the manager starts where binding is refused, such as a macOS App Sandbox without thecom.apple.security.network.serverentitlement.Changes
inittakesstartServer(defaulttrue, so existing users are unaffected). Withfalse:portis ignored.ensureActive()does nothing.dispose()works.getCacheUrlandHttpCacheStream.cacheUrlthrow a newCacheServerUnavailableExceptionwhen there's no server. CheckHttpCacheManager.hasServerorHttpCacheStream.hasCacheUrlbefore asking.initclears its pending future only after the future is stored. Without a server and withcacheDirorconfiggiven, the init closure has noawait. It would then clear_initFuturebefore the assignment, so a stale future kept handing out a disposed manager.Tests
test/e2e/serverless_test.dart(9 tests) covers:ensureActive();dart analyze lib testis clean.startServer: false.Why
ReliefMix now plays every stream through SoLoud, straight from the manager's streams, so it no longer uses the loopback server. Because
initalways bound that server, Mac App Store builds never started the manager and never cached a streamed sound.